<?php
	class Model {
		var $db;
		function Model() {
			$conf = new Config();
			$this->db = new Database( 
				$conf->item('db_host'),
				$conf->item('db_user'),
				$conf->item('db_password'),
				$conf->item('db_database')
				);
		}
		
	}
	
	class PaginatingModel extends Model{
		var $pageNumber;
		var $numPerPage;
		var $foundRows;
		function PaginatingModel() {
			parent::Model();
			$conf = new Config();
			$this->numPerPage = $conf->item('res_num_per_page');
			$this->pageNumber = 0;
		}
		function getNumPages() {
			$n = ceil($this->foundRows/$this->numPerPage);
			return $n;
		}
		function setPageNumber($n) {
			$this->pageNumber = $n;
		}
	}